/*
题目链接:
*/https://leetcode.cn/problems/solving-questions-with-brainpower/description/?envType=daily-question&envId=2025-04-01

//题解代码:
class Solution {
public:
    #define ll long long
    long long mostPoints(vector<vector<int>>& questions) {
        int n =questions.size();
        vector<ll> dp(n+1);
        dp[n] = 0;
        for(int i=n-1;i>=0;--i){
            int val = questions[i][0],m = questions[i][1];
            dp[i] = max(dp[i+1],val+dp[min(n,i+m+1)]);
        }
        return dp[0];
    }
};
